package com.ryan.spring.annotation.config;

import com.ryan.spring.annotation.model.Person;
import com.ryan.spring.annotation.service.CommonServoice;
import org.springframework.context.annotation.*;
import org.springframework.stereotype.Service;

/**
 * Created by kaimin on 23/1/2019.
 * time : 23:09
 */
@Configuration//告诉spring容器这是一个配置类
//扫描规则，或者多个扫描规则
//@ComponentScan(value="com.ryan.spring.annotation"
//        ,excludeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Service.class})})
@ComponentScans(value = {
        @ComponentScan(value="com.ryan.spring.annotation"
                ,excludeFilters = {@ComponentScan.Filter(type = FilterType.ANNOTATION,classes = {Service.class}),
                //CommonServoice的类型都会加入到容器综中
                @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,classes = {CommonServoice.class})
        }
                ,useDefaultFilters = false
                )
})
//FilterType.ANNOTATION 按照注解
//FilterType.ASSIGNABLE_TYPE,按照给定的类型
//FilterType.ASPECTJ,
//FilterType.REGEX,
//FilterType.CUSTOM;
public class CustomConfig {

    @Bean
    public Person person(){
        return new Person("ruan",12);
    }
}
